/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package calculator;

/**
 *
 * @author tonya
 */
public class Calc {

    public static int count (int a, int b, char c)
    {
        int result;
        switch (c)
        {
            case '+':
            result=a+b;
                break;
            case '-':
                result=a-b;
                break;
            case '*':
                result=a*b;
                break;
            case '/':
                if (b==0)
                {
                    throw new ArithmeticException("Деление на 0 запрещено");
                }
                else 
                {
                  result=a/b;  
                } 
                break;
            default:
                throw new IllegalArgumentException("Нет такой операции");            
        }
        return result;
    }
}

